package vn.nad.aoeclips.common.social.facebook;

import android.app.Activity;

import com.facebook.Session;
import com.facebook.Session.StatusCallback;

public class FacebookController {
	public static void loginFacebook(Activity activity, StatusCallback statusCallback){
		Session session = Session.getActiveSession();
		if (!session.isOpened() && !session.isClosed()) {
			session.openForRead(new Session.OpenRequest(activity).setCallback(statusCallback));
		}else {
			Session.openActiveSession(activity, true, statusCallback);
		}
	}
	
	public static void logoutFacebook(){
		Session session = Session.getActiveSession();
		if (!session.isClosed()) {
			session.closeAndClearTokenInformation();
		}
	}
}
